{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import matplotlib.image as pimg\n",
    "import seaborn as sb         # 一个构建在matplotlib上的绘画模块，支持numpy,pandas等数据结构\n",
    "%matplotlib inline\n",
    "\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.metrics import confusion_matrix     # 混淆矩阵\n",
    "\n",
    "import itertools\n",
    "#  keras\n",
    "from keras.utils import to_categorical         #数字标签转化成one-hot编码\n",
    "from keras.models import Sequential\n",
    "from keras.layers import Dense,Dropout,Flatten,Conv2D,MaxPool2D\n",
    "from keras.optimizers import RMSprop\n",
    "from keras.preprocessing.image import ImageDataGenerator\n",
    "from keras.callbacks import ReduceLROnPlateau\n",
    "\n",
    "from PIL import Image\n",
    "from PIL import ImageFilter\n",
    "import types\n",
    "# import cv2\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAAAAAD/MOQvAAAGX0lEQVR4nI2WW4xWVxXH/2vtvc853zfzMcNtYAqFUoFCqKVQpSClQCRFS7xU25iorRprNbw1GpsY9a2xiSY+aKxVY0x8UGxsG2kolkJNS2trL9AWuRXlOiBymct3O+fsvdfyQYYwfANlPa7s/H/n/99r731IMX5FIpC3qgwIq9gLfW+hRMKBAATDEiyTMKClsYhGQd7lWXCXaNGVIJCmSRkQgjIE5kI7TwkB8E6DY6gwAwVSBYGgUAKKVFFm1wJRaDQgKAGEGJPRPsXIBoAYVaCtaWQHtDOi2K5wFE2i8ckYrStCznc7JWnWJDJLsBiNS4oEpJJ3ifGDNrHWEHm1UDUQ1mABIg2GrwUSGRGmnUUDUGkvxuWtIlhAh9OzA+fPJB/vScCKYL1lAKKl845xcT2Aix/YUQMvnqnH7taEyTPnzWCHonKh71SHJ6J+fM+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p1/i7voKIwhGCU9zSmF5ZWTWgUHWZEPSiRhnhI0gPNNC74OL0zxaxJoFIpJJlfakry4fnnR6I22VcmTOfI1QUnvsSNQiXcO1xkE71SULymuKS8F73iSZv4RMTQysIFKG6voP/eT1jz504l1+efPnl03PJwAWDoK/eSC9qyvHa4fiWV2c0qjKpY46nEjQTd5WPrWIQ2DxIIqkBeyCJ37YPfHrPS4+OjQ/660IQSEatzjWsA4tsw1sk/vM0AXGmOp4fv1I781tN+XZHhbvrGqRiVihGF2hnH7nqVhb8nulZoVIEahcXFRb7o2J0c2LFGT7Deko5FInnXFN/JVryL01C7YAUQXGwIANp2D9xi3nYv+BubZiihSlpT8nKNMFIBz/yISz5YweIwx0DFiHkzj4g+f7Pnz/HZdPiZIWxmqjK6cK4JkBAYdG04VijnJURFN0QTvyHw/Syt7n2Wzi5Ra9gwpDBSASo+otk4dRcGkLVBAtgHp1vDPRAREqmYXH/NIAo89yKUhZhAnCQRPVPGGfKkgjuNkFGucojv9oiQcXnUsLBZKKUyHDKCKstIkykJWmhmAMgIjhcRidTlSCsDEd2SoIIgaelCxBvSWgDKgimnaFVEFARMjQWf8DPwE2ib4N2gcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<PIL.Image.Image image mode=L size=100x30 at 0x7EFE05E47750>"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# im = Image.open('./images/zfb/10.png')\n",
    "# # 基本处理，灰度处理，提升识别准确率\n",
    "# im = im.convert(\"L\")\n",
    "# # im = removeFrame(im, 1)\n",
    "# im"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "def remove_noise(im, threshold=180):\n",
    "    height , width = im.shape[0], im.shape[1]      \n",
    "    for x in range(0, height):\n",
    "        for y in range(0, width):        \n",
    "            if ima[x, y] > threshold:\n",
    "                ima[x, y] = 255\n",
    "            else:\n",
    "                ima[x, y] = 0 \n",
    "    return ima\n",
    "\n",
    "def remove_white(im, threshold=180):\n",
    "    height , width = im.shape[0], im.shape[1]  \n",
    "    start_height = 0\n",
    "    end_height = height\n",
    "    for x in range(0, height):\n",
    "        for y in range(0, width):        \n",
    "            if ima[x, y] > threshold:\n",
    "                ima[x, y] = 255 \n",
    "    return ima\n",
    "def formatImg(filePath):\n",
    "    im = Image.open(filePath)\n",
    "    # 基本处理，灰度处理，提升识别准确率\n",
    "    im = im.convert(\"L\")\n",
    "#     im = removeFrame(im, 1)\n",
    "    return im"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [],
   "source": [
    "def cut_white_area(im, threshold=187, num=4):\n",
    "    height , width = im.shape[0], im.shape[1]  \n",
    "    minx = height\n",
    "    miny = width\n",
    "    maxx = 0\n",
    "    maxy = 0\n",
    "    for x in range(0, height):\n",
    "        for y in range(0, width):\n",
    "            if ima[x, y] < threshold:\n",
    "                if minx > x:\n",
    "                    minx = x\n",
    "                if miny > y:\n",
    "                    miny = y\n",
    "                if maxx < x:\n",
    "                    maxx = x\n",
    "                if maxy < y:\n",
    "                    maxy = y\n",
    "    print(\"h:{} ,w:{}\".format(maxx - minx, maxy - miny))\n",
    "    new_img = ima[minx:maxx + 1, miny:maxy + 1]\n",
    "#     width = new_img.shape[1]\n",
    "#     a = [0]\n",
    "#     for i in range(1, num + 1):\n",
    "#         a.append(int(width / num) * i)\n",
    "    # 前后增加5个像素\n",
    "    # a[0] = a[0] + 5\n",
    "    # a[-1] = a[-1] - 5\n",
    "\n",
    "#     nim = []\n",
    "#     for i in range(0, num):\n",
    "#         w1, w2 = getlr(a, width, i)\n",
    "#         nim.append(Image.fromarray(new_img[:, w1:w2].astype('uint8')).convert('L')\n",
    "#                    .resize(my_config.img_size, resample=Image.ANTIALIAS))\n",
    "        \n",
    "\n",
    "    return new_img\n",
    "def getlr(a, width, i):\n",
    "    return a[i], a[i + 1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAACGCAYAAADEpdGPAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO2df3xdZX3HP9/7I7/TkLRpmiZNC/0BbYFSKAiKP4Ai1Tnqr7ExHLjhmJNNq24KTEX3mq+hgMzNTUVlAwciIkjnKKgViowiNkCF/qKlLaVt2vxo2iZNkyb3PvvjXs73+32ac3ubhJue5Pv+J8+557nnPOc55z55ns/5/iDnHAzDMIzoERvtBhiGYRhDwwZwwzCMiGIDuGEYRkSxAdwwDCOi2ABuGIYRUWwANwzDiCjDGsCJaAkRbSKiLUR0w0g1yjAMwzg2NFQ7cCKKA3gFwKUAdgL4HYArnXPrR655hmEYRhiJYXz3PABbnHNbAYCI7gewFEDoAD6pJu5mTEsO45T5kwb/YyLxuf/vilSZ1D4nasvvDbi0qpekwRcyA97ZEt7x36DX+ydaTFzPqesIb58kFnKeYyGPNtRjDIUUuD/9awwj39b59yBsyemfN9fx0yH9nu8x/G/L48l+988j98lnMOE9f/K8YcfORa7z5nt/chH23PqMxLnGCs2/72t3ztX6nw9nAG8A8LrY3gngLbm+MGNaEs89Pm0Yp8yfnvSRoFxMfJl9bkDVk/vi3g+h36UGLbeLYwNAfbw0KMuHvSN9WNWbGCvFYLzS36u2pye4Tf3g85aQvl293rW8QRkVqe2wH67/Q02LgbSYCvOPFgC603z9sRyqXlz8Y/PrhV2jfw/KKD5ovaT3eQKD1wOAbtfHbUJ4m+SzJfta9jMAdInnqUz0e4/rV/UqY3xf96a4DXXxYlVPtqNPHMO/p2F9Jq8v0yY+r99PQ0H+lnL9U/F/j+OZeP2W1w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fHC58CsEFsfw3AHc65WQA6AVw7Kq0qPN8E8Jhz7jQAC5Dpk3H3XBBRA4BPAljknDsdmZzRf4Lx+1wck0LOwM8DsMU5t9U5dwTA/QCWFvD8o4pzrsU593y23IXMj7QBmT64O1vtbgDvH50WFhYiagTwBwC+n90mABcDeDBbZVz0BRFVAXgHgB8AgHPuiHNuP8bpc4FMfKZSIkoAKAPQgnH4XORLIQfwBgCvi+2d2c/GHUQ0A8BCAL8FUOeca8nu2gOgbpSaVWj+BcDnwOktJwLY71wQKWq8PB8nA2gD8J9ZOen7RFSOcfhcOOd2AbgNwA5kBu4DAJoxPp+LvLCXmAWGiCoA/BTAMufcQbnPZUyCxrxZEBG9D0Crc655tNtyApAAcDaAbzvnFiITakLJJePouahGZuVxMoCpAMoBLBnVRp3gFHIA3wVgmthuzH42boN83BwAAAFzSURBVCCiJDKD973OuYeyH+8lovrs/noAraPVvgLyNgCXE9F2ZKS0i5HRgU/KLp2B8fN87ASw0zn32+z2g8gM6OPxuVgMYJtzrs051w/gIWSelfH4XORFIQfw3wGYnX2jXITMy4nlBTz/qJLVeH8AYINz7hti13IA12TL1wB4pNBtKzTOuRudc43OuRnIPAe/ds5dBeAJAB/OVhsvfbEHwOtEdGr2o0sArMc4fC6QkU7OJ6Ky7O/ljb4Yd89FvhQ6GuF7kdE+4wDucs59tWAnH2WI6EIAvwHwElj3vQkZHfwBAE0AXgNwhXNu36g0chQgoncB+Dvn3PuI6BRkZuQ1AF4A8BHnXN9otq8QENFZyLzMLQKwFcCfIzO5GnfPBRF9BcAfI2O19QKAjyGjeY+75yIfzBPTMAwjothLTMMwjIhiA7hhGEZEsQHcMAwjotgAbhiGEVFsADcMw4goNoAbhmFEFBvADcMwIooN4IZhGBHl/wFaUP/G1pDm6gAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(30, 100)\n",
      "h:19 ,w:60\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAACOCAYAAAAhHfOYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAK0klEQVR4nO3dXaxc11mH8edfJ21JQOTLWKaxSAppqwglbmWFVkQobUkxVUVB4qKBi1xEmItWKhISOCDxdVUuoFQCVTLUpEiQIgqhURTVDaFSblCSE5oaJ2kSU1zFxomdlIqKSlHjvlzMNjoJPjlnZs/smb3O85OOZvaa7bPfd2bNe7bXWnsmVYUkafzesOwAJEnzYUGXpEZY0CWpERZ0SWqEBV2SGmFBl6RG9CroSfYneTrJ8SQH5xWUJGl6mXUdepIdwDPArcBJ4FHgtqp6cqN/c9UVO+qaPRfPdDxJbXjm6CUXbH/bDd/ZVjFM47GjL79YVTs32++iHse4CTheVV8HSPI54MPAhgX9mj0X88iRPT0OKWnsfuaH916w/ciRx7dVDNPYsfv4N7ayX58hl7cAz63bPtm1SZKWYOGTokkOJFlLsnb2pXOLPpwkbVt9CvopYP34ydVd26tU1aGq2ldV+3ZeuaPH4SRJr6fPGPqjwHVJrmVSyD8C/NJcomLjMa5lO/KfqznGJg2l73tzld9Di6o7Q+U8c0GvqleSfAw4AuwADlfVE3OLTJI0lT5n6FTV/cD9c4pFktSDV4pKUiMs6JLUCAu6JDWi1xj6djTNLPgqz+arfau6Umxoq/A89I/h+Jb28gxdkhphQZekRljQJakRFnRJaoSTogs09suINbtVmIhbBavQVy8UQ6uvj2foktQIC7okNcKCLkmNsKBLUiMs6JLUiG23ymUVZrz7xrDhF9yuwIqC7abV1RLT2o59b5qch+onnqFLUiMs6JLUCAu6JDXCgi5Jjeg1KZrkBPBt4BzwSlXtm0dQQ9tocsMJL+n/G9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u/vPA7uWGcw8JLkGeCfwMI3k1w1LPA6cAR4A/h34VlW90u0y1r75J8BvAN/rtq+kjbzOK+BLSR5LcqBrG3ufvBY4C/xlN1T2F0kuZYa8nBRdoJr8aR31MqIk3w/8PfBrVfXf6x8bc35Vda6q9jI5o70JeMeSQ+otyYeAM1X12LJjWaCbq+pdTIZtP5rkp9Y/ONI+eRHwLuDTVfVO4H94zfDKVvMauqCfAvas2766a2vJC0l2A3S3Z5Ycz8ySXMykmP91Vf1D19xMfgBV9S3gy0yGIi5Lcv5bvMbYN38S+LkkJ4DPMRl2+RTjz+v/VNWp7vYMcA+TP8Zj75MngZNV9XC3/XkmBX7qvIYu6I8C13Wz7m8EPgLcO3AMi3YvcHt3/3YmY8+jkyTAZ4CnquqP1z00+vyS7ExyWXf/+5jMDTzFpLD/Yrfb6HKrqjur6uqquobJe+ufq+qXGXle5yW5NMkPnL8PfAA4xsj7ZFU9DzyX5O1d0/uBJ5klryVMAHwQeIbJmOVvL3tComcudwOnge8y+St7B5MxyweBZ4F/Aq5Ydpwz5nYzk//iHQUe734+2EJ+wA3AV7rcjgG/07W/FXgEOA78HfCmZcfaI8dbgPtayqvL46vdzxPn60cjfXIvsNb1yX8ELp8lL68UlaRGOCkqSY2woEtSIyzoktQIC7okNcKCLkmNsKBLUiMs6JLUCAu6JDXifwG7wctBtaPFFAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "im = formatImg('./images/zfb/6.png')\n",
    "plt.imshow(im)\n",
    "plt.show()\n",
    "ima = np.asarray(im).copy()\n",
    "print(ima.shape)\n",
    "threshold = 60\n",
    "ima = remove_noise(ima, threshold)\n",
    "ima = cut_white_area(ima, threshold)\n",
    "im2 = Image.fromarray(ima.astype('uint8'))\n",
    "plt.imshow(im2)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAAAAAD/MOQvAAAGLElEQVR4nJ2WW4xVZxXH/+u77L3P2eecuWFnpkCYDMHIgNCgI6EmaILaC6mmsU1N1WKiYmL0oU0fbEx9aHzzwaoPaFMVDVpp1GrSBEmlpWSqDnUEBtKB4TJlOgwDzO3cz97fZfkAzGA8M9D+H/daO7/vv9a39trEuC4rnSTvkww1IpRiLx0UgVneiBsCEaGhIAQMkWQ2yupGRE4SjBIA4AmE/xfdhHhhnWANLhcAVFUIcKqEVzfijgAWoNQhEMRMXrK3QoK8U46lAAHcDHELxEgQsYOgmobJmiSQrMCVwo14QkIQMQNgEPGce28Li9lsvUAEZhLMEEtgbh4U0khHWiJFZEOdqJi894LyN+MBCJxaDoUTwk+cnbxcW9tq1ItrV3+oEJJ3AZEH2KnlII1AipGJC9Pxyu3tjuY7vVOSE42bPfEAC625EuvipQsjY1fOfCc/3XL114WNWz7amyfNIHE9bZlysTN798yBBJsv7N4omcGKPUPfiNdCTpBFoml26MjQeBVb9nQyfrDPgXVP38c39UWg2zqBJF8Gxbbe+erb/XMPPBwLw3oxMRRzxy8kaXFy7Fya1Q2f291ZjYuHvSAWExffWvMChfCCRDMnCxDH1GBJdRfM+srQ1PBPdn81YgIvZDaO/faIjRwcgkaDco98rpJJbf9FbZ0nrttaJgRzc8jCQ8kmTbyym5WXZnZTMvfDf1rPFeGdt85XPCoXR2zWG8eBlQi2foviaqDHYx8/9umuXLo51ATiWw7VzImR6jMvVZNwz/ldLiz1HYtafjw5+kzsHFgxZVM5NTyDmstlpusds2rD063kpB+ZqKhtT+RmTtbiXABw81lchAReBA1293Z1PfIqU7R9ID277keHnng8b7VNhA5cpu9unwZTA1E6nW97dr1nxPN/mWRhxnrXrep2kuC5abFugXDKh+sh7ZR+bYWC9l1D1fqRnfte+NOLr1/6ymqab0PPY3FD+F9NpKmSz91jZDXvBw8g2xgYbunZ9g0Q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U2kk+4wAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<PIL.Image.Image image mode=L size=100x30 at 0x7EFEF90CC310>"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def connected_domain(ima, threshold=180):\n",
    "    height , width = ima.shape[0], ima.shape[1]\n",
    "    dic = {}    \n",
    "    for x in range(0, height):\n",
    "        for y in range(0, width):        \n",
    "            if ima[x, y] > threshold:\n",
    "                ima[x, y] = 255 \n",
    "    \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [],
   "source": [
    "dic = {}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {},
   "outputs": [],
   "source": [
    "s = set()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [],
   "source": [
    "s.add(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {},
   "outputs": [],
   "source": [
    "dic[1] = s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{1: {1, 2}}"
      ]
     },
     "execution_count": 98,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dic"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAD0AAAAUCAAAAAAbqmrLAAAAxklEQVR4nJVTWw7DMAizo9z/yt4HeUAgW4bUFmFeTlwKfxm130AHaN5DG64sWkF30Nd6Jp8AFeJVB2Z4hpqPKqZeiwFAwt5cuSzbLDb+mrM1EAEEYyNJup1IqybkPbReNnqMyNW0J2zAghcJ9DnIPp7+EEbZflh3K7nroLAVhQB7d27Ok9tVOn6ZHotTUpJxYEKduIMXcdeZHm0v/0gJCodST5du1ry0IB0WvbkUo8QjWi9idvgvwr/fzKmTKrHQ+UqXfpwmPnaZRSr6q3qrAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<PIL.Image.Image image mode=L size=61x20 at 0x7EFEF90EF1D0>"
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "im2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAFEAAABMCAAAAAAwrASvAAABDElEQVR4nO1Xyw7DIAyLq/3/L3uHvvKCMmnSdjCHliaOY0JoN9C+PLZvE4pRjGIUoxjFKEYx/pgR7hrsLCAjpj+vQDMYXUiAdxrRJ9+tMAMQ/YB7eg0CR2aMfFONZsa2Qh5ANx2uGgnapMlT7FMftNWIG51lcpavY/R0NDMQKF4miZYxT/2IFBIfGlvYa/gbXYfs/TnaZEZH3z2uWuBFOUJG51YAcNhbYAj056WMrBElZyyGc46OgV9ginEhVyErPEvYCmLacQv/0Er3NAfjyHbt/JmaLDgLq+5LyNOea7CikQV6yXh64fQaJ6CUZwruOzyN46W9JnRJ40fjn76FYhSjGMUoRjGKUYz3eANBLEqefpG5tgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<PIL.Image.Image image mode=L size=81x76 at 0x7EFEE5EC90D0>"
      ]
     },
     "execution_count": 116,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "im2.rotate(60, expand=1,fillcolor=255 ).rotate(-60, expand=1,fillcolor=255 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "ima = np.asarray(im)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAKgAAAAoCAIAAADlmSY7AAAk9UlEQVR4nNV8ebBlx1nfr/ez3P0tM/Nm02hkSbaELGHhxJYhMYRUihRlygESXGBsMPIC3mQHvIHAkRGWwRuLcQKYJQtgoBIKJ8TBsR2wKnEsS7I0SBots0iambfd7dyz9pY/+r47T6OR7XFREf7q1psz557Tp0//+lv69319iW485wAAD2PAGAjgPQhFlddRS8HXoA6wk+Fmd9D3LiaUAdwD8HAE1sNYIzkAS+AoAHACBk/hAQprrXOOUkopBUAIAeC9DwfOOeccISR8a8PZXUIBANZZRhkB6rpWSpz/uqIogAQAQAAGMJSYEUIsLAFlYBIxMYABLJDi0qQGKEDhGTTg4MJrMjh4S5xnTDrvHGEArVzTosklPuDZEco5tAaARnsuQCiaxhGCqqqjlrJN4ayG0zCmO+g73TTVDLCA2d4agmAyqRiBnM+dpwkBAMaYEIIxRgjx3jvn8FT4OefhW/IMqAMgnja1BqCUgqdNpU1j4SkIkALl/LLZ1gwekkQElMzvpoCbd+aC1r+uEXrKjQSgAAOqMg+oh74xEGN1RKNLf8CzIxwEzmsQUTeFVKm1dlYMB/GSigh8yRQBiLeOcApYSqlK0JTblEXLyx0ASjAKzMoqiSXgn9I2ATyCri/OBaTDX2stgAu+BSHYhfeiJcYIpQIO1jrGqdY2bam3v+VtCtH+fQfe8NbXh4e3+i14bJ7bWt67hLlJArCD/gXtfj1CdrCf3+0IwEBbcRsesNRWJYsTeKpnZdSNL/0Bz44Q773WtRCibkol5SyfttIEcID/dx//zTNnnlhZWUmSJJ/NRqPR4cOHs8nJN7z57UAERLr0Imo5B+tBOQAHWAoHUDIfMGqMCdocFH1uz61dwB/OOOe895RS7NL5+ZEHgHxWcc6F4N7497///VEUnTx58qO//mF4/NIv3L65Pox5tH/f/tff8jrTON6hnjoL6+AAMDDmORzgAHHhEHwN8fDne+Qwn0leZ7lg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wwHEo7SkNjFwpD/oEx41RmiErTRFUYS13KIcbXdm8sJxmM2cd+0kZQyYYjabBV59a2sLCmVW1nUdrgxzKBYJKFVJ/IGPfjS8D6eckx2F/7rfkDsP78EYPIGMBADKmJBhelJtLKMSAONURTGASLYBeOezrIzj1GgTRbzbveTgLqh4sISBSnTObW9v72ZPzwuBcy7P83a77Ymxfp7izLKs3W6Hv4ZoAUEI2bu28g0h/AzSFBARA1pEEUCFBDfxULylYIG//MQfAhDaCQIUHorMizx3otfZbLbgSi8yDq3WPOUNoIU4joWzeVks7VsCoJSK47gsZpJxpmSWZ401ztJpluFQHwS2qW1M/MVemH7V/SOUcDjAE2irPaCtcfDWO22NcVYqxQSMA6EQCtajaZz3LIoSKSPOKCH0mYv2vtrwL34Sx3tf13Vd15TSpaWli/oHD0coWu3Uw3X6XTBfu2qcj5J2bGFkKiwMkzRvinClcdpf1Opcel09kiiYxdoUFFZEEZyFmhewVHUhgAhQYZgjYq0NLGRRFIGo/ioZmiDGGot5qmwymXDOlVJ5nqPwVFDvfZwkoYynnbY9QbvdzoocNcChtaag/uk29mu96f8Dcv1njyC/cJAAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=168x40 at 0x7EFE05E78E90>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "im"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAKgAAAAoCAIAAADlmSY7AAAIB0lEQVR4nO2cW2wU1x3G57pz2d3Z6yxrL7DYmATyQNpURaostUrSSFX6klbNhTQUKMEFGzDYgA0xNlCDwRgbG8uGxgGHpEkfitIUqZc8VKpa8RChtiGhApKAL8Gw3uvM7MzOzs6lD5Foa8+a2DM7i+P9PVnnnDnfJ33ac3TO/MegpmlAiYUHVGwDJYoDUmwDhthd34gBeKhscW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mBNwBwbAUA6QSZe9bv9mK12BGgjLmkMBTZnt8BOb4/G4w+28Na6/plIUFU+ybrcrLRkqdJ7pOLdh02EjU5tOe2/bzAMO7mrXRMUaM/dZvWTp9X/fsEGqKbNdu3YthJKiKPp8+h8qMWmOIEg+K378yXUjQvPpG4AHcrDHitrqKdy68pGXIP2wOcWWgUDAmQUZnkVR/QmFnGAjSFkWv1NdbUToaxV8UajweOWsjEsmXKoAAJBOp21Z0IbZ7sRiugMIlFQgCCOJE39/y4hQKXijfHT+NybORhAEqip8RvCV6S/1kiKrCsRyRv8HQOnt3MMFwzAIgmAYxvP6R1YNBJxOJycY/Ub9P761A2hZM2nIAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<PIL.Image.Image image mode=RGB size=168x40 at 0x7EFE05E78090>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Image.fromarray(remove_noise(im, 180*3).astype('uint8'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(40, 168, 3)"
      ]
     },
     "execution_count": 87,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ima.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "41.5"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ima.shape[1]/4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "a=(0,int(ima.shape[1]/4),int(ima.shape[1]/4)*2,int(ima.shape[1]/4)*3,ima.shape[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoA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ApWWshC93PBY23WbBRqGAEmszouwSC5r1MRsQ5crfQCbn9uYUE7Nlq9maNMnqM12/3snd3H3iZKui2Xy1GLSpuQo2BwjkzAz3/wbxN27yDVugGtI3AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<PIL.Image.Image image mode=L size=41x42 at 0x7F7D9ECCAE90>"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Image.fromarray(ima[:,0:a[1]].astype('uint8')).convert(\"L\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAACkAAAAqCAAAAAALny2EAAADFUlEQVR4nH2UzW4cRRSFv1tV3T1/9sSOPZJJkEBCGCkYwQKxiKKIbFgisecdeCwkFrwCSKwiIVCywAQpGlAM9tiTscf2TP9U1WUxHtuZbqhVl3T63HtO3XtEiQYqB8LiKNxcbo7JMVVFskQAUkcBuN+ONz928zaAyoJSRJuQ4/fvvpi58edyU7kJB6L5fsyLrQcIIDct1DnnyV5MeHr9JyrNrKIUGd7pkknlP7RLFIJ5Q4IqYGtII2BBrsyJQeOZPnkS69VdjCpiRBUwmIfbk/5J6hsadScDKIZHjxZS+FGnX3engyZFL8eXmib2k4VFlSsT/+V58VOrSTsAAYyo6GSDgx3yVl2RVGosGiwQxcDkjoTJ3SaXFCAEn1qIVmcdAA1JHfkrGsWYcnPQQRSiFCZB69VduktILrtcHpx7Wt2pEGx/JyNiNBrBxxRAJ/J62HvXMU3aGg2MBoiGs9Fp6iyqMRrpD7LSZN5KFH12+LCnSKHZomsVgoOCDOZtv3+xxSFODobpmjJ6hABeE9Uy2JYieBxVUhZrKKIvJc9Uqhen20fdj5yWaZ6JADrrCHBx9tdejwIX3KU8fyAQTZHy+3E/Pf2MEKxFDUAsq7X96W5/4dJ0dFxmNvtwnPX052zvF0zW669Hk/uWA+ZtPzzuvrWZd0RnHbzLn28Vo+0PqmfVzj05H0+rbrX+dqqFc0RMcXj06fUaXo06KrF63G5/vzohKmb5pVfr9lq/2LTf1h8Ts3IPG3MzS3rFKk7V3bosTDet6h9Na8g3OQXQ9JXbqIfILaSoymIv7+cbp/P/6XO55aWctId3shrwVp+KgsaEaHqEenWpFlhvUUXUJ4/XD59a71aQ0RhHKIvqOgmsXkTDfNU8wHlrLRABVJj5dyZb0q5niDrno1nmkiBdJq1XNIQNJtjUGS0FEEXQib9fmqa0Kf4+zl23tQuiAkW6Mw+R0LCbf9x7D8p8GfGts6oza4836pyiEDFEAQKm+Go+/6ElNc5gDGAMVBApSk1HSadAG15zOQt5cLn/5k+7dmET/c6mNU75F/szf6mWQsSaAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<PIL.Image.Image image mode=L size=41x42 at 0x7F7D9ECCA6D0>"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Image.fromarray(ima[:,a[1]:a[2]].astype('uint8'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAACkAAAAqCAAAAAALny2EAAADYElEQVR4nIWUO29cVRSF19rn3DN3ZuzxRDYOCQKEKEDQISQafgIVQjQgOipqCgok6CIkRAEIiTJV/kD+BEKiCi+JIFkiGGM7GY9n5j7O3ptinnYwnPLc766z137RsXkUBOlY3sr6U8Tjx+kEHODm7b+QThAOEv4/5BK7GNdlkvMX6cDl9y+RMgd8wf6Hpi6UAdAvBnqJtFUQdF6w/rgmTaDRRXOX48GmhYvxzNB+c94M649AAdl2rtSEfVu1n6p8sv/2PnLRbJCXNCefT7c+zBH8zD/YaRLlSrIF2sK96gpogbPelaRCQ8vJDujCrGnDvlwAYUrrpE4Deu2hqK727sCsi1x4jshaIGyQ92avAN4UYE6Wo5m4R/fgVIRcAG4IAIym99ryBYEy0lzFAk1aiS4ZQU0CAUBd4nf7ulX/Ug1vlmwtFtpICTECpkDugABcQeFvvetof0jOAKVUZZkGg6CajOYihJsQTs/Mv5/4q6FJHD2oiPJGf3Z0bii9mWkUf21hZ3xyylnHcXD/mZtd1D4bnRU6lT6rKhZpMCzD9yHS1NA/N7Z8tOPF2eHx4CXxseiD82tP2smY2nikMQbLSJ3cKJtfu8chuVLaJpZNzyfoYyqBioAMgcr2/iBH0NxBqWObZCpyqzy+pUGa6Z2ftz6uB22xKp7IfAIK5DNLbM8PXp4GoOi99ZTU/emqRG6QecJm3t1Crr98bvhmSY7hsc53NORVKWOW+XQFEA5pDtuighU0y+FHxI3+cQHcgQSoWjWYPG9BNZoj1Ne9XjWdolj85YqE2d2fnn0jJjerBdpRSLskwwwy7zoGmIc/nh513c0thCbsTZjWTWcmAOBuBCB/hUZEHU7vNKcRzXoeg0QiuntoxIPvtdqBB5KIW49M4qQnBnF6m3TpLkAhVZMUUQMAGe1t+brli9UcNSScsddTF0UGOTwoTmmr10cmq01dkMA0ZAiC1/b3jbC3MUZDW1QzEYTi0chqTSDC7e3p+7axYY6TAE4A7hC+GIbWIRxm96epEF1m3n1vGacKgOL1wfYRSLes5e62jNeZx8MzgbsTQGjJa/nhXfNMR/vE0Xuys246DAcLTZkhTaXtd/8kJEv1xeFu6SjqFcnlYkcAMrvvZP1qHOhfc/fdoBNbawL/AGPuwXosSt6mAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<PIL.Image.Image image mode=L size=41x42 at 0x7F7D9ECD6110>"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Image.fromarray(ima[:,a[2]:a[3]].astype('uint8'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAACsAAAAqCAAAAAAPav25AAACmElEQVR4nO2TzW8cRRDF3+vq2fnY9e7aiwOJEglxQEIKBy6c+Ici5RQpkfgSSLZ84sYl8A8BEuSCRCRuyIkgduzYO98z3V0cFiKtMmOZO3Xr7l9Xv9dVRcW1w1wf/Z/9T6wHAOV2LRTg6A27veRIGYOncOzwGnk3ut7Y6iFG+21vzcbEG2xkCNpttqj98PPSeui2hgrWDP1E+de5icPGmycUJEP49UPYXidORQWufnXWRZH26e05GlLVC8uUCC0iZ/nLx2WG/LnbaXNJot0V4SzaGACo6sQoOmNB6I9zL3WZ7N9M12GJl28hGMAVc3oXCQMB5BevWmu6dvpRMMXstw80WADQRhi8ncALEAx/noS6ubPcJQBqLwZwP33SIu6a7LVxL4CSv9+aAk6o6IMRunr+w87qjygOYRblWoXV7anmU69WwCfqVNK6NmmsrptXtHf1cudFuodaExWgQbIpZ2B9cqZJLUINAcpsLdHZndxoO30/ei1BLYrnF1QvUDBoYDCGvKIrqWhDgjJbH0raHBlVUnV4AozHZMKLzD2eH+OQqgOd82/YfEHxC/2y47uzfIkr52IJdKEzXbx3ci8Zxf7Rq3WG9tD6Z9+zTTfWBrodAAzqDC8/m5yU35IRlOSoYhMU+Xe2WNiYf1pAr5g/46NWPWDw6NNV1VfUsh7VG1z7+MXyFPM83Fp/MQlWebo/rJehPIgKXYCX7zxdTT8Xu7bTOh1mvXu0QPe1VKkeCYojQ5TpSN3w1aRsDiIzO+fDs+NI9VyHswKmq6RKxJz6G4z2bi7uh93K9SOsfU/ePuk1seh8flncqOvMRSOsPpWLbwxiLRLx82OfxW0aRlgum+SAEOwAMWYAR7ti45ggAaDdfwBcQobZvwFaUzyQjNuUywAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<PIL.Image.Image image mode=L size=43x42 at 0x7F7D9ECD6710>"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Image.fromarray(ima[:,a[3]:a[4]].astype('uint8'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
